﻿using System;
using Game.Model;
using UnityEngine;
using UnityEngine.UI;

public class MapCharacterView : MonoBehaviour
{
    private MapCharacter _mapCharacter;

    public Text _NameLabel;

    public void SetMapCharacter(MapCharacter mapCharacter)
    {
        _mapCharacter = mapCharacter;
        _NameLabel.text = mapCharacter.Name;
    }

    private void Update()
    {
        if (_mapCharacter != null)
        {
            var position = _mapCharacter.WorldPosition;
            transform.localPosition = new Vector3(position.x, position.y, 0);
        }
    }
}